import { http } from "@/utils/http";
import { number } from "echarts";

// 获取待分拣包裹数量

export const getOutboundPendingNumApi = (warehouseId: string) => {
  // console.log("getLogin data:", data);
  return http.request<any>(
    "get",
    `/cp/orderfills/pending-out-warehouse/count`,
    {
      params: {
        warehouseId: warehouseId
      }
    }
  );
};

// 获取装箱列表
type outboundListQueryType = {
  warehouseId: string;
  queryDate: string;
  skip: number;
  limit: number;
};
export const getOutboundListApi = (queryObj: outboundListQueryType) => {
  // console.log("getLogin data:", data);
  return http.request<any>("get", `/cp/packages`, {
    params: {
      ...queryObj
    }
  });
};

// 查询装箱单明细
export const getOutboundDetailApi = (packageId: string) => {
  // console.log("getLogin data:", data);
  return http.request<any>("get", `/cp/packages/${packageId}`);
};

// 查询配送商
export const getDistributorsApi = (warehouseId: string) => {
  // console.log("getLogin data:", data);
  return http.request<any>("get", `/cp/distributors`, {
    params: {
      warehouseId
    }
  });
};

type outboundType = {
  userId: string;
  packageId?: string;
  orderfillIds: string;
  deleteOrderfillIds?: string;
  distributorId: string | number;
  type: number;
};

// 出库
export const submitOutboundApi = (data: outboundType) => {
  // console.log("getLogin data:", data);
  return http.request<any>("post", `/cp/packages/out-warehouse`, {
    params: {
      ...data
    }
  });
};

// 保存装箱
